//
//  MeCopyRightView.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/6/7.
//

import UIKit
import SnapKit

class MeCopyRightView: View {

    override func setUpView() {
        //version
        let infoDictionary = Bundle.main.infoDictionary!
        let appVersion = (infoDictionary["CFBundleShortVersionString"] as? String) ?? ""//主程序版本号
        let versionLabel = ContentLabel(R.font.interMedium(size: 12),hexStr: "#292D3299")
        versionLabel.text = "Version " + appVersion
        self.addSubview(versionLabel)
        versionLabel.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.width.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        //copyright
        let year = DateUtil().getDatetimeStr(Date(), format: "yyyy")
        let copyRightLabel = ContentLabel(R.font.interRegular(size: 12),hexStr: "#292D3266")
        copyRightLabel.text = "© " + year + " GreenDeal.All rights reserved."
        copyRightLabel.numberOfLines = 0
        copyRightLabel.textAlignment = .center
        self.addSubview(copyRightLabel)
        copyRightLabel.snp.makeConstraints { make in
            make.top.equalTo(versionLabel.snp.bottom).offset(10)
            make.width.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview()
        }
    }
}
